﻿@using Lavka.Models
@{
    <div id="MenuPath">
    @switch (ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString().ToLower())
    {
        case "products":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "category":
                        var categoryProducts = (IEnumerable<Products>)ViewData.Model;
                        if (categoryProducts.Count() > 0)
                        {
                            var categoryName = categoryProducts.First().Caterories.Name;
                            var id = categoryProducts.First().Caterories.CategoryId;

                            @Html.ActionLink("Все товары", "List", "Products")
                            <text>→</text>
                            @Html.ActionLink(categoryName, "Category", "Products", new { categoryId = id}, null)                                   
                        }
                        break;
                case "brand":
                        var brandProducts = (IEnumerable<Products>)ViewData.Model;
                        if (brandProducts.Count() > 0)
                        {
                            var brandName = brandProducts.First().Brands.Name;
                            var id = brandProducts.First().Brands.BrandId;

                            @Html.ActionLink("Все товары", "List", "Products")
                            <text>→</text>
                            @Html.ActionLink(brandName, "Brand", "Products", new { brandId = id }, null)
                        }
                        break;

                case "list":
                            @Html.ActionLink("Все товары", "List", "Products")               
                       break;
                       
                case "galery":
                            @Html.ActionLink("Все товары", "Galery", "Products")               
                       break;
                       
                case "details":
                       Products product = (Products)ViewData.Model;
                        
                        @Html.ActionLink("Все товары", "List", "Products")
                        <text>→</text>
                        @Html.ActionLink(product.Caterories.Name, "Category", "Products", new { categoryId = product.CategoryId }, null)
                        <text>→</text>
                        <text>@product.Name</text>
                         break;
            }
            break;
        case "actions":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "index":
                        @Html.ActionLink("Все товары", "List", "Products")
                        <text>→</text>                     
                        <text>Акции</text> 
                   break;
            }
            break;
        case "search":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "Find":
                        @Html.ActionLink("Все товары", "List", "Products")
                        <text>→</text>                     
                        <text>Поиск</text> 
                   break;
            }
            break;
        case "articles":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "index":
                        @Html.ActionLink("Главная", "Index", "Home")
                        <text>→</text>                      
                        <text>Все статьи</text>   
                   break;
                case "details":
                   var Article = (Articles)ViewData.Model;
                        @Html.ActionLink("Главная", "Index", "Home")
                        <text>→</text>    
                        @Html.ActionLink("Все статьи", "Index", "Articles")
                        <text>→</text>
                        @Article.Title
                   break;
            }
            break;
        case "orders":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "create":
                        @Html.ActionLink("Все товары", "List", "Products")
                        <text>→</text>                    
                        <text>Оформление заказа</text>  
                   break;
            }
            break;
        case "home":
            switch (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower())
            {
                case "payment":
                        @Html.ActionLink("Главная", "Index", "Home")
                        <text>→</text>                    
                        <text>Оплата</text>
                   break;
                case "delivery":
                        @Html.ActionLink("Главная", "Index", "Home")
                        <text>→</text>                    
                        <text>Доставка</text>  
                   break;
                case "contacts":
                        @Html.ActionLink("Главная", "Index", "Home")
                        <text>→</text>                    
                        <text>Контакты</text>  
                   break;

            }
            break;
    }
    </div>                    
}